package com.jielihaofeng.shop.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @ProjectName: application-middle-platform
 * @Package: com.oig.amqp.config
 * @ClassName: Swagger3Config
 * @Author: liziba
 * @Description: swagger3配置文件
 * @Date: 2020/12/10 13:36
 * @Version: 1.0
 */

@Configuration
public class Swagger3Config {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(buildApiInfo())
                .select()
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .paths(PathSelectors.any())
                .build();
    }


    @Bean
    public ApiInfo buildApiInfo() {
        return new ApiInfoBuilder()
                .title("springboot-shop接口文档：[springboot-shop-swagger3]")
                .description("更多资讯请联系服务开发者Johnnie Wind.")
                .contact(new Contact("Johnnie Wind", "www.jielihaofeng.com", "johnnie_wind@163.com"))
                .version("1.0")
                .build();
    }
}
